home *** CD-ROM | disk | FTP | other *** search
- Path: stern.fokus.gmd.de!news
- From: Watson <sayegh@fokus.gmd.de>
- Newsgroups: comp.lang.c
- Subject: Re: sizeof arrays in structs
- Date: Fri, 26 Jan 1996 10:59:48 +0100
- Organization: GMD FOKUS - Research Institute for Open Communication Systems
- Message-ID: <3108A614.A7F@fokus.gmd.de>
- References: <doc-150196151101@doc.farallon.com>
- NNTP-Posting-Host: pollux.fokus.gmd.de
- Mime-Version: 1.0
- Content-Type: text/plain; charset=iso-8859-2
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b5 (X11; I; SunOS 5.4 sun4m)
-
- eric doc kampman wrote:
- > typedef struct {
- > unsigned long a[];
- > size_t count;
- > } CountArray;
-
- This expression's already illegal (at least with C).
- An array must have a known size.
-
- > main()
- > {
- > size_t aSize, tSize;
- >
- > tSize = sizeof( tCArray ); // <--compiler is happy
- > aSize = sizeof( aCArray.a ); // <--compiler says "illegal use of sizeof"
-
- No size is no size is no size.
- You MUST use pointers if you don't know the size
- of an array.
- --
- * Greetinx from Watson (sayegh@fokus.gmd.de)
- http://www.fokus.gmd.de/ovma/employees/sayegh/entry.html
- signal(SIGSEGV,SIG_IGN);
-